package com.tongji.housediy.view.components
{
	import flash.display.Sprite;
	import flash.geom.Point;
	
	/**
	 * 
	 * @author chenchao
	 * 
	 */
	public class InfoLine extends Sprite
	{
		public var data:Vector.<Number>;
		
		public function InfoLine(data:Vector.<Number>)
		{
			this.data = data;
			draw();
		}
		
		public function reDrawing(data:Vector.<Number>):void
		{
			this.data = data;
			draw();
		}
		
		public function resetSecondPoint(point:Point):void
		{
			this.data[2] = point.x;
			this.data[3] = point.y;
			draw();
		}
		
		public function addOffsetPoint(offsetX:Number, offsetY:Number):void
		{
			this.data[0] += offsetX;
			this.data[1] += offsetY;
			this.data[2] += offsetX;
			this.data[3] += offsetY;
			draw();
		}
		
		private function draw():void
		{
			this.graphics.clear();
			this.graphics.lineStyle(1, 0xffffff);
			this.graphics.moveTo(data[0], data[1]);
			this.graphics.lineTo(data[2], data[3]);
			this.graphics.beginFill(0xffffff);
			this.graphics.drawCircle(data[0], data[1], 2);
			this.graphics.endFill();
		}
	}
}